package com.zto.sch.advance.aqs.luban;

import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @program: sch-diy-parent
 * @description:
 * @author: sch
 * @create: 2021-01-14 14:59
 **/
public class ThreadParkDemo {
    ReentrantLock reentrantLock = new ReentrantLock();
    public static void main(String[] args) throws InterruptedException {
        System.out.println("----------m1-----------");
        Thread t1 = new Thread("t1") {

            @Override
            public void run() {
                System.out.println("----t1-----");
                //让当前线程睡眠
                LockSupport.park();
                System.out.println("----t2-----");
            }
        };
        t1.start();
        Thread.sleep(2000);
        LockSupport.unpark(t1);
        System.out.println("--------m2---------");


    }
}
